#!/bin/bash

# 检查是否是 root 用户，如果不是则提示使用 sudo
if [[ $EUID -ne 0 ]]; then
    echo "Please run as root or use sudo"
    exit 1
fi

# 配置 Docker 镜像源
echo '{
  "registry-mirrors": [
    "https://proxy.1panel.live",
    "https://docker.1ms.run",
    "https://docker.ketches.cn"
  ]
}' > /etc/docker/daemon.json

# 重启 Docker 服务以使配置生效
systemctl restart docker

# 输出成功信息
echo "Docker registry mirrors configured successfully and Docker service restarted."
